USE [AmazonMWS]
GO

/****** Object:  Table [con].[AmazonOrders]    Script Date: 11/08/2015 23:57:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [con].[AmazonOrders](
	[AmazonOrdersID] [int] IDENTITY(1,1) NOT NULL,
	[SiteId] [int] NULL,
	[AccountInfoId] [int] NOT NULL,
	[AmazonOrderId] [nvarchar](20) NULL,
	[IsDetails] [bit] NULL,
	[SellerOrderId] [nvarchar](20) NULL,
	[PurchaseDate] [datetime] NULL,
	[LastUpdateDate] [datetime] NULL,
	[OrderStatus] [nvarchar](20) NULL,
	[FulfillmentChannel] [nvarchar](10) NULL,
	[SalesChannel] [nvarchar](50) NULL,
	[OrderChannel] [nvarchar](20) NULL,
	[ShipServiceLevel] [nvarchar](50) NULL,
	[NumberOfItemsShipped] [decimal](18, 0) NULL,
	[NumberOfItemsUnshipped] [decimal](18, 0) NULL,
	[PaymentMethod] [nvarchar](5) NULL,
	[MarketplaceId] [nvarchar](20) NULL,
	[BuyerEmail] [nvarchar](50) NULL,
	[BuyerName] [nvarchar](30) NULL,
	[ShipmentServiceLevelCategory] [nvarchar](20) NULL,
	[ShippedByAmazonTFM] [bit] NULL,
	[TFMShipmentStatus] [nvarchar](30) NULL,
	[CbaDisplayableShippingLabel] [nvarchar](30) NULL,
	[OrderType] [nvarchar](20) NULL,
	[EarliestShipDate] [datetime] NULL,
	[LatestShipDate] [datetime] NULL,
	[IsDel] [bit] NULL,
	[CreateUser] [nvarchar](20) NULL,
	[CreateTime] [datetime] NULL,
	[UpdateUser] [nvarchar](20) NULL,
	[UpdateTime] [datetime] NULL,
 CONSTRAINT [PK__AmazonOr__BE7550527E37BEF6] PRIMARY KEY CLUSTERED 
(
	[AmazonOrdersID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [con].[AmazonOrders] ADD  CONSTRAINT [DF_AmazonOrders_IsDetails]  DEFAULT ((0)) FOR [IsDetails]
GO

ALTER TABLE [con].[AmazonOrders] ADD  CONSTRAINT [DF__AmazonOrd__IsDel__00200768]  DEFAULT ((0)) FOR [IsDel]
GO

ALTER TABLE [con].[AmazonOrders] ADD  CONSTRAINT [DF__AmazonOrd__Creat__01142BA1]  DEFAULT ('Pu') FOR [CreateUser]
GO

ALTER TABLE [con].[AmazonOrders] ADD  CONSTRAINT [DF__AmazonOrd__Creat__02084FDA]  DEFAULT (getdate()) FOR [CreateTime]
GO

ALTER TABLE [con].[AmazonOrders] ADD  CONSTRAINT [DF__AmazonOrd__Updat__02FC7413]  DEFAULT ('FL') FOR [UpdateUser]
GO

ALTER TABLE [con].[AmazonOrders] ADD  CONSTRAINT [DF__AmazonOrd__Updat__03F0984C]  DEFAULT (getdate()) FOR [UpdateTime]
GO

